﻿using System;

namespace PlottingBasics.Functions
{
    public class Poisson
    {
        public static Func<int, double> Pois(double expectedValue)
        {
            FactorialPoorMans fpm = new FactorialPoorMans();
            return x =>
            {
                double result = 1.0;
                for (int i = 1; i <= x; i++)
                {
                    result = result * expectedValue / i;
                }
                double exp = Math.Exp(-expectedValue);
                return result * exp;
            };
        }
    }
}
